package com.example.dts.listener;

import com.example.dts.model.BaseEntity;
import org.springframework.stereotype.Component;

import javax.persistence.PreUpdate;
import java.util.Date;

@Component
public class BaseEntityListener {

    @PreUpdate
    public void preUpdate(BaseEntity entity) {

        if (entity != null) {
            entity.setLastUpdateDate(new Date());
        }
    }
}
